package com.tutucms.service.admin.service;

import com.tutucms.common.model.request.PageCondition;
import com.tutucms.common.model.response.Paging;
import com.tutucms.repo.mapper.UserMapper;
import com.tutucms.repo.util.QueryHelper;
import com.tutucms.service.cache.TuCache;
import com.tutucms.service.admin.model.vo.UserVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by wangxudong on 2020/08/27.
 *
 * @version: 1.0
 * @modified :
 */
@Slf4j
@Service
@Transactional
public class UserService {

    @Autowired
    private UserMapper userMapper;

//    @TuCache(key = "'user_list:'+#pageCondition.pageIndex + '_' + #pageCondition.pageSize")
    public Paging<UserVo> getUserList(PageCondition pageCondition) {

        QueryHelper.setupPageCondition(pageCondition);

        return QueryHelper.getPaging(userMapper.fetchUserLikeUserName(QueryHelper.createFullLikeFilterText("")), UserVo.class);
    }
}
